import request from '@/utils/request'

/**
 * mis接口
 * @method GetMisItemList 获取所有项目列表
 */
export function useMisApi() {
  return {
    /**
     * 获取所有项目列表
     * @param params
     */
    GetMisItemList<T = any>(params?: object) {
      return request<T>({
        url: '/api-mis/Item/list_item',
        method: 'get',
        params
      })
    },
    /**
     * 公告管理 - 首页显示
     * @param data
     */
    GetBulletinList: async (data?: object) => {
      return request({
        url: '/api-mis/OA/bulletin_list',
        method: 'post',
        data
      })
    },
    /**
     * 获取会计科目列表
     * @param params
     */
    GetFinanceList: async (params?: object) => {
      return request<{ id: string; name: string; value: string; label: string }[]>({
        url: '/api-mis/AccountBase/finance_list',
        method: 'get',
        params
      })
    },
    /**
     * 厂商列表
     * @param params
     */
    GetSupplierList: async (params?: object) => {
      return request<{ id: string; name: string }[]>({
        url: '/api-mis/AccountMember/supplier_list',
        method: 'get',
        params
      })
    },
    /**
     * 公告管理-查询
     * @param data
     */
    GetBulletinQuery: async (data?: object) => {
      return request({
        url: '/api-mis/OA/bulletin_query',
        method: 'post',
        data
      })
    },
    /**
     * 公告管理-查询详情
     * @param params
     */
    GetBulletin: async (params?: object) => {
      return request({
        url: '/api-mis/OA/bulletin',
        method: 'get',
        params
      })
    },
    /**
     * 待办 - 我的待办
     */
    GetOwnTodo<T = any>() {
      return request<T>({
        url: '/api-mis/OATodo/own_todo',
        method: 'get'
      })
    },
    /**
     * 待办 - 全部标记为完成
     */
    PutAllFinish<T = any>() {
      return request<T>({
        url: '/api-mis/OATodo/todo_all_finish',
        method: 'put'
      })
    },
    /**
     * 待办 - 标记为完成（单行）
     */
    PutFinish<T = any>(params?: object) {
      return request<T>({
        url: '/api-mis/OATodo/todo_finish',
        method: 'put',
        params
      })
    },
    /**
     * 薪资发放
     */
    PostMonthPay<T = any>(data?: object) {
      return request<T>({
        url: '/api-mis/SalaryPay/month_pay',
        method: 'post',
        data
      })
    },
    /**
     * 库存品 - 列表
     */
    GetProducts<T = any>(params?: object) {
      return request<T>({
        url: '/api-mis/WareHouseProduct/products',
        method: 'get',
        params
      })
    },
    /**
     * 库存品规格 - 列表
     */
    GetProductModels<T = any>(params?: object) {
      return request<T>({
        url: '/api-mis/WareHouseProduct/product_models_list',
        method: 'get',
        params
      })
    },
    /**
     * 库存项目分类
     */
    GetStockItems<T = any>(params?: object) {
      return request<T>({
        url: '/api-mis/WareHouseItem/items',
        method: 'get',
        params
      })
    },
    /**
     * 库存品仓库
     */
    GetWarehouses<T = any>(params?: object) {
      return request<T>({
        url: '/api-mis/Warehouse/warehouses',
        method: 'get',
        params
      })
    },
    /**
     * 智能家居订单
     */
    GetSmartShopOrder<T = any>(data?: object) {
      return request<T>({
        url: '/api-mis/WareHouseInventory/smartshop_order_query',
        method: 'post',
        data
      })
    },
    /**
     * U上商旅订单
     */
    GetUsUngOrder<T = any>(data?: object) {
      return request<T>({
        url: '/api-mis/WareHouseInventory/usungst_order_query',
        method: 'post',
        data
      })
    },
    /**
     * 优翔商城（美人香）订单
     */
    GetUsUngShopOrder<T = any>(data?: object) {
      return request<T>({
        url: '/api-mis/WareHouseInventory/usungshop_order_query',
        method: 'post',
        data
      })
    }
  }
}
